package iCalendar;
import java.util.Vector;

import javax.swing.JList;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import main.Main;
import database.Database;
import database.dateTime.DBDateTime;


public class List implements ListSelectionListener  {
	
	public void valueChanged(ListSelectionEvent e) {
	    if (e.getValueIsAdjusting())
	        return;

	    JList theList = (JList)e.getSource();
	    if (theList.isSelectionEmpty()) {
	        
	    } else {
	        String test = (String) theList.getSelectedValue();
	        System.out.println(test);
	    }
	}


	
	public static void main (String[] args) {
		try {
			Database db = new Database("test");
			Main.initConnection("test", "", "");
			//IDBRelCourseFile dfj = new IDBRelCourseFile();
			//String temp = "01/06/200900:59";
			//String temp2 = "01/06/200923:59";
			//String temp3 = "28/05/200912:00";
			/*System.out.println(temp.length());
			System.out.println(temp2.length());
			System.out.println(temp3.length());*/
			
			/*db.event.add(temp, temp2, "een taak", true, temp3, "Tis nie moeilijk");
			db.task.add("Datastructuren", "Afwerken oef1.", false, 16, "Tis gemakkelijk");
			db.proj.add("project databases", "USIM", false, 19, "Meer Info", "nog even en tis af");
			db.rTE.add("Datastructuren", temp, "een taak");
			db.rTE.add("project databases", temp, "een taak");*/
			//Vector<objects.Event> v = db.event.getAllDeadlines();
			//Vector<objects.Event> v = db.event.getAllEvents();
			//Vector<String> v1 = new Vector<String>();
			
			/*for (int i = 0; i < v.size(); i++) {
				System.out.println(v.get(i).getIsDeadline());
				System.out.println(v.get(i).getSummary());
				v1 = db.rTE.getTasks(v.get(i).getStart(), v.get(i).getSummary());
				for (int j = 0; j < v1.size(); j++) {
					System.out.println(v1.elementAt(j));
				}
			}*/
			
			DBDateTime d = DBDateTime.create("20090603T134523");
			DBDateTime e = DBDateTime.create("20090403T134526");
			DBDateTime f = DBDateTime.create("20100208T083000");
			db.task.add("Praktijk Algoritmes en complexiteit", "Afwerken oefeningen tegen begin volgende les", false, 12, "geen extra info");
			db.proj.add("Project databases", "Maak een USIM", false, 18, "niets", "persoonlijke deadline = 10/05/2009");
			db.exam.add("Datastructuren", "Grafen", false, 12, "geen extra info", "G006", 4, 'B', false);
			
			db.event.add(d.toString(), f.toString(), "test", true, e.toString(), "geen");
			//db.event.add(d, f, "test", true, e, "geen");
			db.rTE.add("Praktijk Algoritmes en complexiteit", d.toString(), "test");
			db.rTE.add("Project databases", d.toString(), "test");
			
			/*db.teach.addTeacher("Guy.Vansteen@ua.ac.be", "Van Steen", "Guy", "03/690.69.69", "Professor Discrete Wiskunde", "G204", "Prof.");
			db.teach.addTeacher("Frans.Arickx1@ua.ac.be", "Arickx", "Frans", "Professor Inleiding programmeren", "G204", "03/690.69.69", "Prof.");
			db.teach.addTeacher("Chris.Blondia1@ua.ac.be", "Blondia", "Chris", "Professor Computernetwerken", "G204", "03/690.69.69", "Prof.");
			db.stud.addStudent("mario.degroof@student.ua.ac.be", "De Groof", "Mario", "Uitstekende student", "degroofmario@hotmail.com");
			db.contact.addContact("ronny.king@hotmail.com", "King", "Ronny", "Zanger");*/
			
			/*db.contact.addContact("Frans.Arickx@ua.ac.be", "Arickx", "Frans", "Professor Inleiding programmeren");
			db.contact.addContact("Chris.Blondia@ua.ac.be", "Blondia", "Chris", "Professor Computernetwerken");
			Vector<objects.Contact> v = db.contact.getAllContacts();
			for (int i = 0; i < v.size(); i++) {
				//db.contact.delContact(v.get(i).getEmail());
				System.out.println(v.get(i).getForename() + "\t" + v.get(i).getName());
				System.out.println(v.get(i).getEmail() + "\n" + v.get(i).getPhoneNumber());
			}*/
		} catch (Exception e){
			e.printStackTrace();
		}
		
	}
}
	